﻿using System;
using System.ComponentModel;
using System.Runtime.InteropServices;

namespace Teigha.Core
{
	public class SpaModeler : OdRxModule
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public SpaModeler(IntPtr cPtr, bool cMemoryOwn) : base(GlobalsPINVOKE.SpaModeler_SWIGUpcast(cPtr), cMemoryOwn)
		{
			this.swigCPtr = new HandleRef(this, cPtr);
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		public static HandleRef getCPtr(SpaModeler obj)
		{
			if (obj != null)
			{
				return obj.swigCPtr;
			}
			return new HandleRef(null, IntPtr.Zero);
		}

		~SpaModeler()
		{
			this.Dispose();
		}

		public override void Dispose()
		{
			if (this.swigCPtr.Handle != IntPtr.Zero)
			{
				if (this.swigCMemOwn)
				{
					lock (this.locker)
					{
						if (this.swigCPtr.Handle != IntPtr.Zero && this.swigCMemOwn)
						{
							this.swigCMemOwn = false;
							GlobalsPINVOKE.delete_SpaModeler(this.swigCPtr);
						}
					}
					this.swigCMemOwn = false;
				}
				this.swigCPtr = new HandleRef(null, IntPtr.Zero);
			}
			GC.SuppressFinalize(this);
			base.Dispose();
		}

		public virtual OdResult setSPAParameters(SPAParameters pParameters)
		{
			OdResult result = (OdResult)GlobalsPINVOKE.SpaModeler_setSPAParameters(this.swigCPtr, SPAParameters.getCPtr(pParameters));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual void getSPAParameters(SPAParameters pParameters)
		{
			GlobalsPINVOKE.SpaModeler_getSPAParameters(this.swigCPtr, SPAParameters.getCPtr(pParameters));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void setSPAtolerances(double resabs, double resfit)
		{
			GlobalsPINVOKE.SpaModeler_setSPAtolerances(this.swigCPtr, resabs, resfit);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void getSPAtolerances(out double resabs, out double resfit)
		{
			GlobalsPINVOKE.SpaModeler_getSPAtolerances(this.swigCPtr, out resabs, out resfit);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual double getSPAresnor()
		{
			double result = GlobalsPINVOKE.SpaModeler_getSPAresnor(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		private object locker = new object();

		private HandleRef swigCPtr;
	}
}
